﻿#ifndef GETMESSAGEINTERFACE_H
#define GETMESSAGEINTERFACE_H

#include <QObject>
#include <Connect/UdpClient.h>
#include <Connect/CpsUdpClient.h>
#include <DbHelper.h>
#include <Connect/SpeechModuleThread.h>
#include <Connect/DataSerialportClient.h>

class GetMessageInterface: public QObject
{
    Q_OBJECT
public:
    GetMessageInterface();
    ~GetMessageInterface();

    Q_INVOKABLE QVariantList getExpLog(int);            // 运行中的实验日志
    Q_INVOKABLE QVariantList getExperimentLog(int,int,QString);     // 单个模块的日志
    Q_INVOKABLE void refMainExpLog(QString);
    QVariantList getReleasseTargetLog(QString);
    QVariantList getPracticeTargetLog(QString);
    QVariantList getShiftingTargetLog(QString);
    QVariantList getPurifyingLog(QString,bool);
    Q_INVOKABLE void readRadiation(int);

    Q_INVOKABLE void setExpBaseInfo(QVariantMap);
    void saveReleaseReportInfo(QString);
    void savePracticeReportInfo(QString);
    void saveShiftingReportInfo(QString);
    void savePurifyingReportInfo(QString);

    Q_INVOKABLE int getExperimentStepCount(int);
    Q_INVOKABLE int getExperimentTotalTime();

    Q_INVOKABLE int getDefaultConnectInfo();
    Q_INVOKABLE void connectEqu(QString,QString,QString);
    Q_INVOKABLE QVariantMap getConnectInfo(int);
    Q_INVOKABLE void readOrWriteConnectInfo(QString,QString,QString);
    Q_INVOKABLE QString unitConversion(QString,QString,QString);
    Q_INVOKABLE QString unitConversionBySerial(QString,QString,QString,QString);

    //总实验流程相关接口

    Q_INVOKABLE QStringList getMainMethodList();
    Q_INVOKABLE QString getConsumableByMainMethod(QString);
    Q_INVOKABLE QStringList getConsumableList();
    Q_INVOKABLE QStringList getSingleMethodList(int, QString consumable="");
    Q_INVOKABLE QStringList getSingleMethodByMainMethod(QString);
    Q_INVOKABLE QString  setExpInfo(int module,QString expName,QString type="");   // 实验类型 expName实验名称 type耗材名称(可选)

    // 报告文件
    Q_INVOKABLE QVariantList getReportInfo();
    Q_INVOKABLE QVariantMap  getReportBaseInfo(int);
    Q_INVOKABLE QVariantList getReportDetail(int);
    Q_INVOKABLE void delReportInfo(int);
    Q_INVOKABLE void confirmClicked(QString);

    Q_INVOKABLE void setSpeechUseInfo(QString);
    Q_INVOKABLE void connectSpeechMode(QString);
    Q_INVOKABLE QStringList getSerialPort();
    Q_INVOKABLE int getSpeechUseInfo();

    Q_INVOKABLE QStringList getStaticNum(int,QString,QString);
    Q_INVOKABLE void resetStaticNum(int type);
    Q_INVOKABLE QStringList getStaticTotalNum(int type);

    Q_INVOKABLE void connectEnergySpectrum(QString);

    Q_INVOKABLE QString getCurrentStepInfo();
    Q_INVOKABLE void reconnect();
private:
    UdpClient *udpClient;
    CpsUdpClient *cpsUdpClient;
    int stepNum;
    int unionStep;
};

#endif // GETMESSAGEINTERFACE_H
